#pragma once

#include <Windows.h>
#include <d3dx9.h>
#include <vector>

#include "..\Util\HjUtil.h"

using namespace std;

struct OBBBox
{
	TCHAR	szName[256];
	D3DXVECTOR3		vNewOBB[8];
	D3DXVECTOR3		vOldOBB[8];

	bool			bUse;
	bool			bDefaultRender;
	int				nXVal , nYVal , nZVal;

	OBBBox() : bDefaultRender(true){}
};

struct	AnimList
{
	int		nID;
	int		nFirstFrame;
	int		nLastFrame;
	int		nBip;
	bool	bEditAnim;

	TCHAR	szName[30];

	D3DXMATRIX**		ppAnimMat;
	D3DXQUATERNION**	ppAnimQuat;

	void	Release()
	{
		if( !this ) return;
		for( int i = 0 ; i < nBip ; i++ )
		{
			if( ppAnimMat )		hjADEL( ppAnimMat[i] );
			if( ppAnimQuat )	hjADEL( ppAnimQuat[i] );
		}
		hjADEL( ppAnimMat );
		hjADEL( ppAnimQuat );
	}

	AnimList() : nFirstFrame(0) , nLastFrame(0) , ppAnimMat(NULL) , ppAnimQuat(NULL) , nBip(0) , nID(-1) , bEditAnim(false){
		hjZERO( szName , 30 );
	}

};

struct	AnimMng
{
    int	nBip;
	int	nAnim;
	int	nLastFrame;

	AnimList*	pAnimList;
	//std::vector< AnimList* >	vtAnimList;	
	//vector<	AnimList >::iterator itAnimList;

	D3DMATRIX**			ppAnimMat;
	D3DXQUATERNION**	ppAnimQuat;

	void	Release()
	{
		//vtAnimList.clear();		

		/*for( itAnimList = vtAnimList.begin() ; itAnimList != vtAnimList.end() ; itAnimList++ )
		{

			vtAnimList.clear();
		}*/

        
		if( pAnimList )
		{
			for( int i = 0 ; i < nAnim ; i++ )
			{
				pAnimList[i].Release();
			}
			hjADEL( pAnimList );
		}

		for( int i = 0 ; i < nBip ; i++ )
		{
			if( ppAnimMat )		hjADEL( ppAnimMat[i] );
			if( ppAnimQuat )	hjADEL( ppAnimQuat[i] );
		}	

		hjADEL( ppAnimMat );
		hjADEL( ppAnimQuat );
	}

	AnimMng() : pAnimList(NULL) , nAnim(0) , ppAnimMat(NULL) , ppAnimQuat(NULL) , nBip(0) , nLastFrame(0)	
	{
		//vtAnimList.clear();
	}
};

struct	ToolData
{
    bool	bOBBAdjust;
	bool	bStartAdjust;
	int		nEffect;

	AnimMng		mAnimMng;
	OBBBox*		pOBB;

	ToolData() : bOBBAdjust(false) , pOBB(NULL) , bStartAdjust(false){}
};

